<?php
if (!defined("_INDEX")) { header("Location: /"); die; }

$title = UV::readMQ(html_entity_decode($route->POST("preview_title")));
$preview = html_entity_decode($route->POST("preview_preview"));
$link = UV::readMQ(strip_tags($route->POST("preview_link")));
$text = html_entity_decode($route->POST("preview_text"));
$tags = UV::readMQ(html_entity_decode($route->POST("preview_tags")));
$time = UV::readInt(strip_tags($route->POST("preview_time")));
$login = $user->getUserLogin();
$name = $user->getName()." ".$user->getSName();

require_once SITE.DS.HEAD;
?>

<div style='margin:20px 0;'>
	<h1>Кратко</h1>
	<div class="news_list">
		<div class="news_list_header">
			<a class="news_list_title">
				<img src='/files/img/<?php if ($link != "") echo "video.png"; else echo "all_news.png"; ?>' style="vertical-align: bottom;margin-right:5px" />
				<?php echo $title; ?>
			</a>
			<div class="news_list_date"><?php
				$wday = getdate($time);
				echo $dayOfWeek[$wday['wday']].", ".date("d",$time)." ".$months[date("m",$time)-1];
			?></div>
		</div>
		<div class="news_list_content">
			<div class="news_list_text"><?php echo $preview; ?></div>
			<div class="news_list_footer">
				<?php /* <a href='/user/<?php echo $login ?>' class="news_list_author"><?php echo $name; ?></a> */ ?>
				<a class="news_list_comments">комментарии (0)</a>
			</div>
		</div>
	</div>

	<h1>Полностью</h1>

	<div id="news">
		<h1><?php echo $title; ?></h1>
		<?php
			if ($link != "")
			{
				$links = array();
				preg_match("/v=([\w-]+)&?/i",$link,$links);
				$link_v = "http://www.youtube.com/embed/".$links[1];
				echo "<div class='news_video'><iframe width='640' height='380' src='$link_v' frameborder='0' allowfullscreen></iframe></div>";
			}
		?>
		<p><?php echo $text; ?></p>
		<p class='news_date'><?php
			echo date("d ",$time).$months[date("m",$time)-1].date(" Y",$time);
		?></p>
	</div>
</div>

<?php require_once SITE.DS.FOOTER; ?>